#pragma once

#include "ThreadPoolImpl.h"


namespace syncLib
{
    class ThreadPoolImpl;

    class ITask;

    class ThreadPool
    {
    public:
        explicit ThreadPool(size_t maxPoolSize);
        ~ThreadPool(void);

    public:

        // Thread pool will automatically clean memory for a task when it finishes
        void ScheduleTask(ITask* task);
        int MaxThreadCount() const;
        int ActiveThreadCount() const;
        bool WaitForDone(int msecs = -1);

    private:
        ThreadPoolImplPtr impl_;
    };

    typedef std::auto_ptr<ThreadPool> ThreadPoolPtr;

};